package homework.printyourself.info.items;


import homework.printyourself.info.BaseObject;
import homework.valid.validators.ValidateChain;
import homework.valid.validators.impl.LengthValidator;
import homework.valid.validators.parser.LongParser;

import java.io.IOException;

public class StudentIDItem extends BaseInformationItem {

    static {
        chain = new ValidateChain(new LongParser("错误输入, 请输入数字"));
        chain.addValidator(new LengthValidator("学号格式错误", 8, 8));
    }

    public StudentIDItem(BaseObject obj) throws IOException {
        super(obj, null);
        itemName = "学号";
        itemValue = fi.input("请输入学号: ", chain).toString();
    }

    public StudentIDItem(BaseObject obj, int value) {
        super(obj, Integer.toString(value));
        itemName = "学号";
    }
}
